home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / midi / ptrply65.lha / PTReplay / examples / SmallPlay.c < prev    next >
C/C++ Source or Header  |  1995-03-13  |  1KB  |  67 lines

  1. /****************************************
  2.  
  3.  PT-Player 2.0   © 1994 BetaSoft
  4.  
  5.  uses PTReplay.library also by BetaSoft
  6.  
  7. ****************************************/
  8.  
  9. #include <exec/types.h>
  10. #include <clib/exec_protos.h>
  11. #include <pragmas/exec_pragmas.h>
  12. #include <dos/dos.h>
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15.  
  16. #include "/include/ptreplay.h"
  17. #include "/include/ptreplay_protos.h"
  18. #include "/include/ptreplay_pragmas.h"
  19.  
  20. struct Library *PTReplayBase;
  21. struct Module *Mod = NULL;
  22.  
  23. char *vstr="$VER: SmallPlay 2.0 (23.12.93)";
  24.  
  25. int main(int argc, char **argv)
  26. {
  27. BYTE SigBit;
  28. ULONG SigMask;
  29.  
  30.     if(argc > 2)
  31.         { puts("specify one module only\n"); return 20; }
  32.     if(argc < 2)
  33.         { puts("play what module?\n"); return 20; }
  34.  
  35.     if(PTReplayBase = OpenLibrary("ptreplay.library",0L))
  36.     {
  37.         if(Mod = PTLoadModule(argv[1]))
  38.         {
  39.             if((SigBit=AllocSignal(-1))==-1)
  40.             {
  41.                 puts("couldn't allocate signal\n");
  42.                 exit(0);
  43.             };
  44.  
  45.             PTInstallBits(Mod, SigBit, -1, -1, -1);
  46.  
  47.             PTPlay(Mod);
  48.  
  49.             SigMask=Wait(SIGBREAKF_CTRL_C | 1L<<SigBit);
  50.  
  51.             if(SigMask & SIGBREAKF_CTRL_C)
  52.                 PTFade(Mod,1);
  53.             else
  54.                 PTStop(Mod);
  55.  
  56.             FreeSignal(SigBit);
  57.  
  58.             PTUnloadModule(Mod);
  59.  
  60.         }else puts("couldn't open/load module\n");
  61.         CloseLibrary(PTReplayBase);
  62.  
  63.     } else puts("couldn't open ptreplay.library\n");
  64.  
  65.     return(0);
  66. }
  67.